<template>
  <div>
    <div class="login">登录界面</div>
      <div>
        <input v-model="ruleForm.username" type="text">
      </div>
     <div>
       <input v-model="ruleForm.password" type="password">
     </div>
    <button type="primary" @click="handleLogin">登录</button>
  </div>
</template>
<script>
export default {
  name: "login-login",
  /**
   * 调用组建
   * @type {Object}
   */
  components: {},
  /**
   * 组建属性
   * @type {Object}
   */
  props: {},
  /**
   * 数据字段
   * @return {[type]} [description]
   */
  data() {
    return {
      ruleForm: {
        username: '',
        password: '',
      },
    };
  },
  /**
   * 计算属性
   * @type {Object}
   */
  computed: {},
  /**
   * 数据监听
   * @type {Object}
   */
  watch: {},
  /**
   * 页面创建时
   * @return {[type]} [description]
   */
  created() {},
  /**
   * 页面加载时
   * @return {[type]} [description]
   */
  mounted() {},
  /**
   * 页面调用函数
   * @type {Object}
   */
  methods: {
    //1是true 0是false
    handleClick(){
      localStorage.setItem("isAuthenticated", 0);
    },
    handleLogin() {
      if (this.ruleForm.username.length < 6 || this.ruleForm.password.length < 6) {
        alert("请输入用户名和密码")
      } else {
        localStorage.setItem('token', 123456) //存储
        this.$router.push({
          path: "/",
        });
      }
    }
  },
};
</script>
<style>
.login{
  text-align: center;
}
</style>